import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/// 介绍各种按钮
///
///

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text('Button 练习'),
      ),
      body: const MyButton(),
    ),
  ));
}

class MyButton extends StatefulWidget {
  const MyButton({super.key});

  @override
  State<MyButton> createState() => _MyButtonState();
}

class _MyButtonState extends State<MyButton> {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Row(
          children: [
            ElevatedButton(onPressed: () {}, child: Text('按钮1')),
            TextButton(onPressed: () {}, child: Text('按钮222')),
            OutlinedButton(onPressed: () {}, child: Text('按钮3333')),
            IconButton(onPressed: () {}, icon: Icon(Icons.thumb_up)),
          ],
        ),
        Container(
          // color: Colors.red,
          margin: EdgeInsets.all(10),
          height: 44,
          child: ElevatedButton(
            onPressed: () {},
            child: Text('登录'),
            style: ButtonStyle(
                backgroundColor: WidgetStatePropertyAll(Colors.red)),
          ),
        ),

        ///带按钮的图标

        Container(
          margin: EdgeInsets.all(20),
          height: 60,
          child: ElevatedButton.icon(
            onPressed: () {
              print('object');
            },
            icon: const Icon(Icons.thumb_up),
            label: const Text('登出'),
            style: const ButtonStyle(
                elevation: WidgetStatePropertyAll(20),
                shape: WidgetStatePropertyAll(
                    CircleBorder(side: BorderSide(color: Colors.red))),
                backgroundColor: WidgetStatePropertyAll(Colors.purple),
                foregroundColor: WidgetStatePropertyAll(Colors.white)),
          ),
        ),

        ///
      ],
    );
  }
}
